namespace java edu.scut.dap.taskcm

struct StartRequest{
    1:required string taskName;
    2:required string operatorName;
    3:required string input;
    4:optional string anotherInput;
    5:required string output;
    6:optional list<string> taskArgs;
}

struct StopRequest{
    1:required i32 taskid;
}

struct StateRequest{
    1:required i32 taskid;
}

struct StateResponse{
    1:required string taskName;
    2:required i32 exitCode;
    3:required i64 timeSpend;
}

exception RequestException{
    1:required i32 exceptionCode;
    2:optional string exceptionReason;
}

service TaskCMService{
    i32 startTask(1:StartRequest request);              //请求启动任务，返回任务id
    i32 stopTask(1:StopRequest request);                //请求终止任务，返回结果码
    StateResponse taskState(1:StateRequest request);    //请求任务状态，返回状态响应
    string getOutputMessage(1:StateRequest request);    //获取任务输出信息
    string getErrorMessage(1:StateRequest request);     //获取任务错误信息
    list<StateResponse> allTaskState();                 //请求所有任务状态
}